<template>
	<view class="page" :style="{'min-height':h+'px'}">
		<c-nav-bar1 title="退款详情"></c-nav-bar1>
		<image class="bg" src="https://i.ringzle.com/file/20240306/db17b6f5596e4bff97b34204a8ac87ac.png" mode="">
		</image>
		<view class="content" :style="{'margin-top':mt+'px'}">
			<view class="t_top box">
				<text class="title" v-if="item.orderState==6">退款中</text>
				<text class="title" v-if="item.orderState==7">已退款</text>
				<image src="https://i.ringzle.com/file/20240304/0b8d658940694e3692a1e7a0b89b6a31.png"></image>
				<view class="tt_text">
					<view>提交订单</view>
					<view>退款审核</view>
					<view v-if="item.orderState==6">审核中</view>
					<view v-if="item.orderState==7">审核通过</view>
				</view>
			</view>
			<view class="t_money box">
				<view class="tm_top">
					<view class="tmt_left">退款总额</view>
					<view class="tmt_right">￥<text>{{object.price}}</text></view>
				</view>
				<text>扣除手续费 ￥0.00</text>
			</view>
			<view class="t_details box">
				<view class="td_item">
					<text class="tdi_left">退回账户</text>
					<view class="tdi_right">原路返回</view>
				</view>
				<view class="td_item">
					<text class="tdi_left">退款流水号</text>
					<view class="tdi_right">
						<text>{{object.orderCode}}</text>
						<view class="copy" @tap="copyOrderNo(object.orderCode)">复制</view>
					</view>
				</view>
				<view class="td_item">
					<text class="tdi_left">退款原因</text>
					<view class="tdi_right">{{object.refundReason}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				h: uni.getWindowInfo().windowHeight,
				mt: uni.getSystemInfoSync().statusBarHeight + 44,
				titleStyle: {
					fontSize: '36rpx',
					fontWeight: "bold",
					color: "#FFFFFF"
				},
				item: {
					orderState: 6,
					// totalPayFee: 299,
					// isRefundInfoId: '1715280788788698769',
					// refundReason: '价格不划算'
				},
				fisherManRefundDto: {
					refundReason: '', //退款原因 
					orderCode: '', //ordercode
					amount: '', //退款金额
				},
				object: {}
			}
		},

		onLoad(option) {
			if (option.object) {
				this.object = JSON.parse(option.object);
				console.log(this.object);
				this.getList()
			}
		},
		methods: {
			copyOrderNo(no) {
				let that = this;
				// #ifdef H5
				this.$copyText(no).then(res => {
					this.$showToast('复制成功');
				})
				// #endif
				// #ifdef MP-WEIXIN
				uni.setClipboardData({
					data: no,
					success(res) {
						that.$showToast('复制成功');
					},
					fail(err) {
						that.$showToast('复制失败');
					}
				})
				// #endif
			},
			getList() {
				// 价格 进行 乘100	   前后端都可以进行处理
				// let refundFee = this.object.list * 100
				// let totalFee = res.data.data.totalFee * 100
				// let outRefundNo = res.data.data.outRefundNo
				// let outTradeNo = res.data.data.outTradeNo
				// // console.log(refundFee, totalFee);
				// const list = {
				// 	refundFee,
				// 	totalFee,
				// 	outRefundNo,
				// 	outTradeNo,
				// 	...this.listData
				// }



				this.$api.post('/order/icbc/refund', this.object.list).then(result => {
					console.log(result);
					if (result.statusCode === 200) {
						this.$showToast('退款成功');
						setTimeout(() => {
							uni.redirectTo({
								url: '/pagesMy/order/index',
							})
						}, 1000)
					} else this.$showToast(result.data.msg);
				})
			}


		}
	}
</script>

<style scoped lang="less">
	.page {
		background: #F5F8FA;

		.bg {
			width: 100%;
			height: 702rpx;
			position: absolute;
			top: 0;
			left: 0;
			z-index: 0;
		}

		.content {
			position: relative;

			.t_top {
				display: flex;
				flex-direction: column;
				width: calc(100% - 48rpx);
				background: transparent;
				padding: 40rpx 24rpx 0;

				.title {
					font-size: 36rpx;
					font-family: PingFang-SC-Bold, PingFang-SC;
					font-weight: bold;
					color: #FFFFFF;
					text-indent: 30rpx;
				}

				&>image {
					width: calc(100% - 60rpx);
					height: 36rpx;
					margin: 36rpx 30rpx 0;
				}

				.tt_text {
					display: flex;
					align-items: center;
					justify-content: space-around;
					margin-top: 24rpx;
					text-align: center;

					view {
						width: calc(100% / 3);
						font-size: 24rpx;
						font-family: PingFang-SC-Bold, PingFang-SC;
						font-weight: bold;
						color: #FFFFFF;

						&:first-child {
							text-align: left;
						}

						&:last-child {
							text-align: right;
						}
					}
				}
			}

			.t_money {
				padding: 48rpx 24rpx;
				display: flex;
				flex-direction: column;
				background: #fff;
				width: calc(100% - 48rpx);
				box-sizing: border-box;
				margin: 40rpx 24rpx 0;
				border-radius: 16rpx;

				.tm_top {
					display: flex;
					align-items: center;
					justify-content: space-between;

					.tmt_left {
						font-size: 36rpx;
						font-family: PingFang-SC-Bold, PingFang-SC;
						font-weight: bold;
						color: #333333;
					}

					.tmt_right {
						display: flex;
						align-items: center;
						font-size: 24rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #FF4141;

						text {
							font-size: 36rpx;
							font-family: DINAlternate-Bold, DINAlternate;
							font-weight: bold;
							color: #FF4141;
						}
					}
				}

				&>text {
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #808080;
					margin-top: 36rpx;
				}
			}

			.t_details {
				padding: 0 24rpx;
				background: #fff;
				width: calc(100% - 48rpx);
				box-sizing: border-box;
				margin: 20rpx 24rpx 0;
				border-radius: 16rpx;

				.td_item {
					padding: 31rpx 0;
					border-bottom: 1rpx solid #EFEFEF;
					display: flex;
					align-items: center;
					justify-content: space-between;

					&:last-child {
						border-bottom: none;
					}

					.tdi_left {
						font-size: 28rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #777777;
					}

					.tdi_right {
						font-size: 28rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #333333;
						display: flex;
						align-items: center;

						text {
							font-size: 28rpx;
							font-family: PingFangSC-Regular, PingFang SC;
							font-weight: 400;
							color: #333333;
						}

						.copy {
							margin-left: 17rpx;
							width: 78rpx;
							height: 36rpx;
							border-radius: 18rpx;
							border: 1rpx solid #EFEFEF;
							line-height: 36rpx;
							text-align: center;
							font-size: 22rpx;
							font-family: PingFangSC-Regular, PingFang SC;
							font-weight: 400;
							color: #999999;
						}
					}
				}
			}
		}
	}
</style>